home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok56
/
m2maker
/
txt
/
m2maker.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
10KB
|
307 lines
(*---------------------------------------------------------------------------
:Program. m2Maker
:Author. Thomas Stolze
:Address. Goslarsche Str. 32, 3000 Hannover 21, Germany
:Phone. (0)511 / 75 10 77
:Version. V2.0
:Date. 10-Nov-90
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga V3.32d
:Contents. Programming Utility.
:Remark. Supports the M2Amiga System (C) by A+L AG Switzerland
---------------------------------------------------------------------------*)
MODULE m2Maker;
FROM Arts IMPORT Assert,wbStarted;
FROM DosL IMPORT Delay;
FROM ExecD IMPORT MemReqs,MemReqSet,Message,MsgPortPtr;
FROM ExecL IMPORT AllocMem,CopyMem,CopyMemQuick,FindPort,Forbid,
FreeMem,GetMsg,Permit,PutMsg,ReplyMsg,WaitPort;
FROM FileRequester IMPORT CauseAction,FileRequestFlags,FileRequestFlagSet,
LoadDir;
FROM GraphicsD IMPORT DisplayFlags,DisplayFlagSet,DrawModeSet,GfxBasePtr,
jam1,jam2,RastPortPtr;
FROM GraphicsL IMPORT AllocRaster,BltClear,FreeRaster,InitBitMap,
SetBPen,SetDrMd,Text;
FROM InitIntuition IMPORT prgPtr,PrintStatus;
FROM InputEvent IMPORT Qualifiers,QualifierSet;
FROM InputHandler IMPORT Guard;
FROM InstallOptions IMPORT ResidentEditor,
ResidentLinker,ResidentCompiler,InstallDebug,
InstallPool,InstallM2Ohm;
FROM IntuiMacros IMPORT ItemNum,MenuNum,SubNum;
FROM IntuitionD IMPORT GadgetFlags,
GadgetFlagSet,GadgetPtr,IDCMPFlags,IDCMPFlagSet,
Image,IntuiMessage,IntuiMessagePtr,IntuiText,
IntuiTextPtr,IntuitionBasePtr,Menu,MenuItemFlags,
MenuItemFlagSet,NewWindow,
ScreenFlags,
ScreenFlagSet,strGadget,
StringInfo,WindowFlags,WindowFlagSet,
WindowPtr;
FROM IntuitionL IMPORT ActivateWindow,DisplayBeep,
MoveWindow,ModifyIDCMP,
OpenWindow,RefreshGadgets,RefreshGList,
SetMenuStrip,SizeWindow,
WBenchToFront,BeginRefresh,EndRefresh;
FROM LSOptions IMPORT LoadOptions,parameterFile,SaveOptions;
FROM Project IMPORT DeleteProject,LoadProject,SaveProject,
TouchProject;
FROM RequesterWindow IMPORT InfoRequester,OptionRequester,HelpRequester;
FROM Routines IMPORT CompileProject,Compiler,DeleteAFile,
EditMakeFile,Editor,FastLister,
Linker,Make,MakePath,New,NewShell,Print,
Project,RenameAFile,Run,Save,SmallWindow,
StartModuleTool,SwitchGadget,TestForFile,
ExecuteStr,KeyMaker,BonusTrack,ByeByeFastLister,
ByeByeCompiler,ByeByeDebug,ByeByePool,
InteractiveCompiler;
FROM SYSTEM IMPORT ADDRESS,ADR,CAST,LONGSET;
FROM String IMPORT Copy,LastPos,Length;
FROM TimerSupport IMPORT PrintHeadLine;
(*FROM InOut IMPORT WriteInt,WriteLn;*)
CONST F1 = 50H; F6 = 55H;
F2 = 51H; F7 = 56H;
F3 = 52H; F8 = 57H;
F4 = 53H; F9 = 58H;
F5 = 54H; F10 = 59H;
space = 40H; C = 33H; Q = 10H; P = 19H; L = 28H; HELP = 5FH;
VAR msg : IntuiMessage;
changeProject : BOOLEAN;
PROCEDURE GetFRInfos(ptr : ADDRESS; mask : LONGCARD): LONGINT;
VAR pos : INTEGER;
BEGIN
IF mask = CAST(CARDINAL,FileRequestFlagSet{giveFileSelected}) THEN
Copy(prgPtr^.BufferString[0],prgPtr^.FR.file);
pos:=LastPos(prgPtr^.BufferString[0],Length(prgPtr^.BufferString[0]),".");
IF pos # -1 THEN prgPtr^.BufferString[0,pos]:=00C; END;
RefreshGList(ADR(prgPtr^.GadgetArray[0]),prgPtr^.window,NIL,1);
ELSIF mask = CAST(CARDINAL,FileRequestFlagSet{giveDirSelected}) THEN
IF (lShift IN msg.qualifier) OR (rShift IN msg.qualifier) THEN
Copy(prgPtr^.BufferString[3],prgPtr^.FR.dirPath);
RefreshGList(ADR(prgPtr^.GadgetArray[3]),prgPtr^.window,NIL,1);
changeProject:=TRUE;
END;
END;
RETURN 0;
END GetFRInfos;
PROCEDURE ChangeProject(change : BOOLEAN);
VAR file,
memo : ARRAY [0..255] OF CHAR;
BEGIN
IF changeProject THEN
changeProject:=FALSE;
IF change THEN
Copy(memo,prgPtr^.FR.dirPath);
MakePath(prgPtr^.FR.dirPath,"m2Maker.cfg",file);
LoadOptions(file); Copy(prgPtr^.FR.dirPath,memo);
Copy(prgPtr^.BufferString[3],memo);
RefreshGList(ADR(prgPtr^.GadgetArray[3]),prgPtr^.window,NIL,1);
SaveOptions(file);
ELSE
MakePath(prgPtr^.BufferString[3],"m2Maker.cfg",file);
LoadOptions(file);
END;
Project(TRUE);
IF change THEN
MakePath(prgPtr^.FR.dirPath,"txt",file);
IF TestForFile(ADR(file)) THEN
Copy(prgPtr^.FR.dirPath,file);
END;
END;
LoadDir(ADR(prgPtr^.FR)); SaveOptions(parameterFile);
PrintStatus("Changed Project !");
END;
END ChangeProject;
PROCEDURE Startup;
VAR idcmp : IDCMPFlagSet;
BEGIN
idcmp:=prgPtr^.window^.idcmpFlags;
ModifyIDCMP(prgPtr^.window,IDCMPFlagSet{});
LoadOptions(parameterFile); changeProject:=FALSE;
IF Length(prgPtr^.BufferString[3]) > 0 THEN
IF NOT TestForFile(ADR(prgPtr^.BufferString[3])) THEN
LoadProject; LoadDir(ADR(prgPtr^.FR));
END;
END;
Project(TRUE); Guard;
ModifyIDCMP(prgPtr^.window,idcmp);
END Startup;
PROCEDURE SaveAllOptions;
VAR dummy : ARRAY [0..150] OF CHAR;
BEGIN
SaveOptions(parameterFile);
IF (selected IN prgPtr^.GadgetArray[16].flags) THEN
MakePath(prgPtr^.BufferString[3],"m2Maker.cfg",dummy);
SaveOptions(dummy);
END;
END SaveAllOptions;
PROCEDURE NewFile;
VAR pos : INTEGER;
BEGIN
Copy(prgPtr^.FR.file,prgPtr^.BufferString[0]);
pos:=LastPos(prgPtr^.BufferString[0],Length(prgPtr^.BufferString[0]),".");
IF pos # -1 THEN prgPtr^.BufferString[0,pos]:=00C; END;
RefreshGList(ADR(prgPtr^.FR.datas^.GadgetArray[4]),prgPtr^.window,NIL,1);
RefreshGList(ADR(prgPtr^.GadgetArray[0]),prgPtr^.window,NIL,1);
END NewFile;
PROCEDURE HandleProgram;
VAR msgPtr : IntuiMessagePtr;
gPtr : GadgetPtr;
bool,
exit : BOOLEAN;
BEGIN
LOOP
WaitPort(prgPtr^.window^.userPort);
msgPtr:=GetMsg(prgPtr^.window^.userPort); msg:=msgPtr^;
ReplyMsg(msgPtr);
gPtr:=msg.iAddress;
IF (closeWindow IN msg.class) THEN
EXIT;
ELSIF (gadgetUp IN msg.class) THEN
CASE gPtr^.gadgetID OF
22 : SmallWindow;
| 10 : NewFile;
ELSE
END;
ELSIF (gadgetDown IN msg.class) THEN
CASE gPtr^.gadgetID OF
0 : Editor;
| 1 : bool:=Compiler(TRUE);
| 2 : bool:=Linker(TRUE);
| 3 : Run;
| 4 : Make(TRUE);
| 5 : ByeByeDebug;
| 6 : OptionRequester;
| 7 : LoadOptions(parameterFile);
| 8 : SaveAllOptions;
| 9 : Save;
| 13 : Print;
| 15 : Project(TRUE);
| 17 : DeleteAFile;
| 18 : New;
| 19 : StartModuleTool;
| 20 : KeyMaker;
| 21 : RenameAFile;
ELSE
END;
ELSIF (menuPick IN msg.class) THEN
CASE MenuNum(msg.code) OF
0: CASE ItemNum(msg.code) OF
0: InfoRequester;
| 1: FastLister;
| 2: NewShell;
| 3: EXIT;
ELSE
END;
| 1: CASE ItemNum(msg.code) OF
0: Editor;
| 1: bool:=Compiler(TRUE);
| 2: bool:=Linker(TRUE);
| 3: Run;
| 4: Make(TRUE);
| 5: KeyMaker;
| 6: ByeByeDebug;
| 7: BonusTrack(prgPtr^.BufferString[14]);
| 8: BonusTrack(prgPtr^.BufferString[15]);
| 9: TouchProject;
|10: CASE SubNum(msg.code) OF
0 : EditMakeFile;
| 1 : CompileProject("",TRUE);
| 2 : CompileProject(prgPtr^.FR.file,FALSE);
ELSE
END;
ELSE
END;
| 2: CASE ItemNum(msg.code) OF
2: InteractiveCompiler;
| 3: ResidentCompiler;
| 4: ResidentLinker;
| 5: ResidentEditor;
| 6: InstallPool;
| 7: InstallDebug;
| 8: InstallM2Ohm;
ELSE
END;
| 3: CASE ItemNum(msg.code) OF
0: CASE SubNum(msg.code) OF
0 : SaveProject(FALSE);
| 1 : SaveProject(TRUE);
ELSE
END;
| 1: LoadProject; changeProject:=TRUE; ChangeProject(FALSE);
| 2: DeleteProject;
ELSE
END;
ELSE
END;
ELSIF (rawKey IN msg.class) THEN
bool:=TRUE;
IF (control IN msg.qualifier) AND (lShift IN msg.qualifier) THEN
CASE msg.code OF
192,208..218 : DEC(msg.code,128); bool:=FALSE;
ELSE
END;
END;
CASE msg.code OF
F1 : Editor;
| F2 : bool:=Compiler(bool);
| F3 : bool:=Linker(bool);
| F4 : Run;
| F5 : Make(bool);
| F6 : KeyMaker;
| F7 : ByeByeDebug;
| F8 : StartModuleTool;
| F9 : Print;
| F10: LoadDir(ADR(prgPtr^.FR));
| space: bool:=WBenchToFront(); ActivateWindow(prgPtr^.window);
| HELP: HelpRequester;
ELSE
IF (control IN msg.qualifier) THEN
CASE msg.code OF
C : NewShell;
| Q : EXIT;
| P : Project(FALSE); msg.code:=0;
| L : LoadDir(ADR(prgPtr^.FR));
ELSE
IF (lShift IN msg.qualifier) THEN
IF msg.code = 0 THEN PrintHeadLine; END;
END;
END;
END;
END;
ELSIF (refreshWindow IN msg.class) THEN
BeginRefresh(prgPtr^.window);
Delay(5);
EndRefresh(prgPtr^.window,bool);
END;
Forbid(); bool:=CauseAction(ADR(prgPtr^.FR),ADR(msg),exit); Permit();
ChangeProject(TRUE);
END;
END HandleProgram;
BEGIN
prgPtr^.FR.func:=GetFRInfos; Startup;
HandleProgram;
END m2Maker.